// pages/mine/store_admin//addyinghang.js
Page({

  data: {  uid:'',list:[],show:false,id:''

  },

  onLoad: function (options) {

  },
   onShow(){
      this.getlist()
  },

   navadd(){
     wx.navigateTo({
       url: '/pages/mine/store_admin/navadd',
     })
   },
   //获取银行卡列表
   getlist(){
     wx.request({
       url: 'https://zujieba.com/Api/money/bank_list.html',
       data:{uid:wx.getStorageSync('uid')},
       method:'POST',
       success:(res)=>{
         console.log(res);
         if(res.data.success==1){
           this.setData({list:res.data.data})

         }else{
           this.setData({list:[]})
         }
         
       }
     })
   },
   navjiebang(e){
    wx.showModal({
      showCancel:true,
      title:"确认解绑吗?",
      success:(res)=>{
        console.log(res);
        if(res.confirm==true){
          
            this.jiebangbank()
            this.setData({show:false})
        }
        
      }
    })
   },
   showtoast(e){
     this.setData({show:true,id:e.currentTarget.dataset.id})
   },
   close(){
      this.setData({show:false})
   },
   jiebangbank(){
    wx.request({
      url: 'https://zujieba.com/Api/money/del_bank.html',
      data:{id:this.data.id,type:1,uid:wx.getStorageSync('uid')},
      method:'POST',
      success:(res)=>{
       if(res.data.success==1){
         wx.showToast({
           title: res.data.tips,
         })
         this.getlist()
        
       }else{
         wx.showToast({
           title: res.data.tips,
           icon:'none'
         })
       }
      }
    })
 },
 navuse(){
  var pages = getCurrentPages()   
    　　 var currentPage = pages[pages.length - 1] 
    　　var prevPage = pages[pages.length - 2]    
       prevPage.setData({bank_id:this.data.id})
       console.log(this.data.id);
       
   wx.navigateBack({
     complete: (res) => {},
   })
 }
})